<div class="row col-sm-12">
  <div id="importBtn">
    <%= render partial: "import", locals: {path: results_room_reports_path(@room, point_id: params[:point_id], name: params[:name], format: 'xls')} %>
  </div>
</div>

<div class="col-sm-10 col-sm-offset-1">
  <div class="tipbar">
     <div class="col-sm-12">
        <span class="text-center"><%= params[:name] %></span>
        <span class="pull-right"><%= params[:start_time] %>&nbsp;&nbsp;<%= params[:end_time] %></span>
     </div>
  </div>
  <div id="main" style="height:450px;"></div>
</div>

<div class="data" data-url=<%= @data %>></div>
<div class="time" data-url=<%= @time %>></div>
<div class="name" data-url=<%= @name %>></div>

<script type="text/javascript">
    var reportsData = $(".data").data("url");
    var reportsTime = $(".time").data("url");
    var reportsName = $(".name").data("url");
    require(
      [
          'echarts',
          'echarts/chart/line' // 使用柱状图就加载bar模块，按需加载
      ],
      function (ec) {
        // 基于准备好的dom，初始化echarts图表
        var myChart = ec.init(document.getElementById('main')); 
        option = {
        tooltip : {
            trigger: 'axis'
        },
        legend: {
            data:['报表']
        },
        calculable : true,
        xAxis : [
            {
                type : 'category',
                boundaryGap : false,
                data : reportsTime
            }
        ],
        yAxis : [
            {
                type : 'value'
            }
        ],
        series : [
            {
                name: reportsName,
                type:'line',
                data: reportsData
            }
        ]
    };
      // 为echarts对象加载数据
      myChart.setOption(option);
    }
  );
</script>